<?php
/**
 * Created by PhpStorm.
 * User: BlueIdeaLirui
 * Date: 2019/09/05
 * Time: 17:24
 */

namespace search\controllers\dataDashBoard;

use business\elasticsearch\services\SupplierBasicService;
use search\controllers\marketDataAnalysis\BaseController;

class SupplierBasicController extends BaseController
{
    /**
     * 区域TOP30供应商行业数据
     * @return \business\base\models\ResultModel
     */
    public function actionSupplierRankingByArea()
    {
        try {
            $area = $this->getParam('area');
            return $this->success((new SupplierBasicService())->getSupplierRankingByAreaList($area));
        } catch (\Exception $ex){
            \Yii::error($ex->getMessage());
            return $this->error('', '获取失败，请稍后重试');
        }
    }

    /**
     * 报名招标\招募行业TOP30数据
     * @return \business\base\models\ResultModel
     */
    public function actionApplyRecruitmentBiddingByArea()
    {
        try {
            $area          = $this->getParam('area');
            $monthlyNumber = (int)$this->getParam('monthly_number');
            return $this->success((new SupplierBasicService())->getApplyRecruitmentBiddingByAreaList($area, $monthlyNumber));
        } catch (\Exception $ex){
            \Yii::error($ex->getMessage());
            return $this->error('', '获取失败，请稍后重试');
        }
    }
}
